# Maintainer: Muflone http://www.muflone.com/contacts/english/

pkgname=perl-graphics-tiff
_perl_namespace=Graphics
_perl_module=TIFF
pkgver=20
pkgrel=2
pkgdesc="Extension for the libtiff library"
arch=('loong64' 'x86_64')
url="https://metacpan.org/dist/${_perl_namespace}-${_perl_module}"
license=('LGPL')
makedepends=('perl-extutils-depends' 'perl-extutils-pkgconfig')
depends=('perl' 'libtiff')
checkdepends=('perl-readonly' 'perl-test-requires' 'perl-test-deep')
source=("https://www.cpan.org/modules/by-module/${_perl_namespace}/${_perl_namespace}-${_perl_module}-${pkgver}.tar.gz")
sha256sums=('3e55cc209465e064019a215a52f05ff51040297d020393fe9fb3de27ad020e35')
options=('!emptydirs')

build() {
  cd "${_perl_namespace}-${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1 PERL_AUTOINSTALL=--skipdeps
  perl Makefile.PL
  make
}

check() {
  cd "${_perl_namespace}-${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1
  make test
}

package() {
  cd "${_perl_namespace}-${_perl_module}-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  make pure_install INSTALLDIRS=vendor DESTDIR="${pkgdir}"
  # Delete unuseful files
  find "${pkgdir}" -name '.packlist' -delete
}
